package cn.stylefeng.guns.modular.gridsystem.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.gridsystem.service.BizGatewayConfigItemService;
import cn.stylefeng.guns.modular.gridsystem.model.param.BizGatewayConfigItemParam;

import javax.annotation.Resource;

/**
 * 网关配置项表 控制器
 *
 * @author: ssy
 * @date: 2022/10/31 15:29
 */
@RestController
public class BizGatewayConfigItemController {

    @Resource
    private BizGatewayConfigItemService bizGatewayConfigItemService;

    /**
     * 分页查询网关配置项表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @GetMapping("/bizGatewayConfigItem/page")
    @BusinessLog(title = "网关配置项表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(BizGatewayConfigItemParam bizGatewayConfigItemParam) {
        return new SuccessResponseData(bizGatewayConfigItemService.page(bizGatewayConfigItemParam));
    }

    /**
     * 获取全部网关配置项表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @GetMapping("/bizGatewayConfigItem/list")
    @BusinessLog(title = "网关配置项表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(BizGatewayConfigItemParam bizGatewayConfigItemParam) {
        return new SuccessResponseData(bizGatewayConfigItemService.list(bizGatewayConfigItemParam));
    }

    /**
     * 查看详情网关配置项表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @GetMapping("/bizGatewayConfigItem/detail")
    @BusinessLog(title = "网关配置项表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(BizGatewayConfigItemParam.detail.class) BizGatewayConfigItemParam bizGatewayConfigItemParam) {
        return new SuccessResponseData(bizGatewayConfigItemService.detail(bizGatewayConfigItemParam));
    }

    /**
     * 添加网关配置项表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @PostMapping("/bizGatewayConfigItem/add")
    @BusinessLog(title = "网关配置项表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(BizGatewayConfigItemParam.add.class) BizGatewayConfigItemParam bizGatewayConfigItemParam) {
        bizGatewayConfigItemService.add(bizGatewayConfigItemParam);
        return new SuccessResponseData();
    }

    /**
     * 删除网关配置项表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @PostMapping("/bizGatewayConfigItem/delete")
    @BusinessLog(title = "网关配置项表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(BizGatewayConfigItemParam.delete.class) BizGatewayConfigItemParam bizGatewayConfigItemParam) {
        bizGatewayConfigItemService.delete(bizGatewayConfigItemParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑网关配置项表
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @PostMapping("/bizGatewayConfigItem/edit")
    @BusinessLog(title = "网关配置项表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(BizGatewayConfigItemParam.edit.class) BizGatewayConfigItemParam bizGatewayConfigItemParam) {
        bizGatewayConfigItemService.edit(bizGatewayConfigItemParam);
        return new SuccessResponseData();
    }

    /**
     * 修改状态
     *
     * @author ssy
     * @date 2022/10/31 15:29
     */
    @PostMapping("/bizGatewayConfigItem/changeStatus")
    @BusinessLog(title = "网关配置项表_修改状态", opType = LogAnnotionOpTypeEnum.CHANGE_STATUS)
    public ResponseData changeStatus(@RequestBody @Validated(BizGatewayConfigItemParam.changeStatus.class) BizGatewayConfigItemParam bizGatewayConfigItemParam) {
        bizGatewayConfigItemService.changeStatus(bizGatewayConfigItemParam);
        return new SuccessResponseData();
    }

}
